package com.cenntro.common.base;

import java.io.Serializable;
import java.util.Collection;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;



public abstract class BaseServiceImpl<M extends BaseMapper> implements BaseService {

	@Autowired
    protected M baseMapper;
	
	@Override
	public int deleteById(Integer id) {
		return baseMapper.deleteById(id);
	}
	
	@Override
	public int insert(Object t) {
		return baseMapper.insert(t);
	}
	
	@Override
	public <T> T selectById(Integer id) {
		return baseMapper.selectById(id);
	}
	
	@Override
	public int update(Object t) {
		return baseMapper.update(t);
	}
	
	@Override
	public int selectCount(Object t) {
		return baseMapper.selectCount(t);
	}
	
	@Override
	public <T> List<T> selectPage(Object t) {
		return baseMapper.selectPage(t);
	}
	
//	@Override
//	public <T> Result selectPage(Object t, boolean isPage) {
//		if (isPage){
//			PageVO pageVO = (PageVO) t;
//			Page<T> page = PageHelper.startPage(pageVO.getPage(), pageVO.getLimit(), true);
//			List<T> list = baseMapper.selectPage(t);
//			return PageResult.ok(list, page.getTotal());
//		}
//		return Result.ok(baseMapper.selectPage(t));
//	}
//	@Override
//	public <T> T select4Condition(Object t) {
//		return baseMapper.select4Condition(t);
//	}
	
	@Override
	public int deleteBatchIds(Collection<? extends Serializable> idList) {
		return baseMapper.deleteBatchIds(idList);
	}
	
	@Override
	public <T> T selectOne(Map<String, Object> columnMap) {
		return baseMapper.selectOne(columnMap);
	}
	
	@Override
	public <T> T selectOne(Object t) {
		return baseMapper.selectOne(t);
	}
	
	@Override
	public <T> List<T> selectByMap(Map<String, Object> columnMap) {
		return baseMapper.selectByMap(columnMap);
	}
	
//	@Override
//	public int deleteById(Serializable id) {
//		return baseMapper.deleteById(id);
//	}
}
